<!DOCTYPE html>
<html class="x-admin-sm">

	<head>
		<meta charset="UTF-8">
		<title>导表入库</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<link rel="stylesheet" href="../../css/font.css">
		<link rel="stylesheet" href="../../css/xadmin.css">
		<script type="text/javascript" src="../../lib/layui/layui.js" charset="utf-8"></script>
		<script type="text/javascript" src="../../js/xadmin.js"></script>
		<script src="../../js/app.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
		<style type="text/css">
			.form-position {
				margin: 0.85rem;
				padding-top: 8px;
				background-color: white;
				
			}
		</style>
		<script type="text/javascript">
			layui.use('layer', function() {
				var layer = layui.layer;

				layer.open({
					content: '请选择入库种类',
					btnAlign: 'r',
					anim: 5,
					icon: 7,
					cancel: function() {}
				});
			})
		</script>
	</head>

	<body>
		<div class="x-nav">
			<span class="layui-breadcrumb">
				<a href="">首页</a>
				<a href="">演示</a>
				<a>
					<cite>导航元素</cite></a>
			</span>
			<a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()"
			 title="刷新">
				<i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
		</div>
		<div class="layui-fluid">
			<div class="layui-row layui-col-space15">
				<div class="layui-col-md12">
					<div class="layui-card">
						<div class="layui-card-body ">
							<div class="layui-collapse" lay-filter="test">
								<div class="layui-colla-item">
									<h2 class="layui-colla-title">先进行选择再扫码入库<i class="layui-icon layui-colla-icon"></i></h2>
									<div class="layui-colla-content" style="display: flex;">
										<div id="form">
			
											<form class="layui-form form-position" style="margin: 0;" action="" lay-filter="Form" id="Form" name="Form">
												<div class="layui-input-inline layui-show-xs-block" >
													<select name="category" id="category" lay-filter="category">
														<option value=""></option>
													</select>
												</div>
												<div class="layui-input-inline layui-show-xs-block">
													<select name="typical" id="typical" lay-filter="typical">
												
													</select>
												</div>
												<div class="layui-input-inline layui-show-xs-block" style="">
													<select name="brand" id="brand" lay-filter="brand">

													</select>
												</div>
										
												<div class="layui-input-inline layui-show-xs-block">
													<select name="model" id="model" lay-filter="model">

													</select>
												</div>
												<div class="layui-input-inline layui-show-xs-block">
													<input type="text" name="serial_number" placeholder="点击录入串号" autocomplete="off"
													 class="layui-input layui-hide" id="serial_number">
												</div>
												
											</form>
											
										
										</div>
										<div class="layui-inline layui-show-xs-block" style="margin-top: 7.2px;margin-left: 4px;">
											<button class="layui-btn"  onclick="InstorageInfo_Ajax()"><i class="layui-icon" >&#x1005;</i>确认入库</button>
										</div>
										<div class="layui-input-inline" style="margin: 8px 8px 8px 4px;">

										</div>
									</div>
								</div>
							</div>
							<div class="layui-card-body " style="padding: 10px 0px;">
								<table class="layui-table layui-form">
									<thead>
										<tr>
											
											<th>串号</th>
											<th>种类</th>
											<th>类别</th>
											<th>品牌</th>
											<th>型号</th>
											<th style="text-align: center;">操作</th>
									</thead>
									<tbody id="table-tby">
										<tr id="Tr">
											
										</tr>
									</tbody>
								</table>
							</div>
							<div class="layui-card-body" style="display: flex;justify-content: center;">
								<div id="demo7">
									<div class="layui-box layui-laypage layui-laypage-default" id="layui-laypage-10"><span class="layui-laypage-count">共
											100 条</span><a href="javascript:;" class="layui-laypage-prev layui-disabled" data-page="0">上一页</a><span
										 class="layui-laypage-curr"><em class="layui-laypage-em"></em><em>1</em></span><a href="javascript:;"
										 data-page="2">2</a><a href="javascript:;" data-page="3">3</a><a href="javascript:;" data-page="4">4</a><a
										 href="javascript:;" data-page="5">5</a><span class="layui-laypage-spr">…</span><a href="javascript:;" class="layui-laypage-last"
										 title="尾页" data-page="10">10</a><a href="javascript:;" class="layui-laypage-next" data-page="2">下一页</a><span
										 class="layui-laypage-limits"><select lay-ignore="">
												<option value="10" selected="">10 条/页</option>
												<option value="20">20 条/页</option>
												<option value="30">30 条/页</option>
												<option value="40">40 条/页</option>
												<option value="50">50 条/页</option>
											</select></span><a href="javascript:;" data-page="1" class="layui-laypage-refresh"><i class="layui-icon layui-icon-refresh"></i></a><span
										 class="layui-laypage-skip">到第<input type="text" min="1" value="1" class="layui-input">页<button type="button"
											 class="layui-laypage-btn">确定</button>
										</span>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			<script src="Select.js" type="text/javascript" charset="utf-8"></script>
			
			<script type="text/javascript">
				layui.use(['layer', 'form'], function() {
					var form = layui.form;
					var layer = layui.layer;
					var typical = document.getElementById("typical");
					var model = document.getElementById("model");
					var Search = document.getElementById("Search");
					var Scan_area = document.getElementById("Scan_area");


                    // 选择最后一个条件框串号框就会显示
					// form.on('select(model)', function(data) {
					// 	var SelectValue = data.value;
					// 	serial_number.classList.remove("layui-hide")
					// 	localStorage.setItem("Conditions_model",JSON.stringify({'model':SelectValue}));
					// })
					
				});
			</script>
			<script type="text/javascript">
				// 提交扫码后的数据
				function InstorageInfo_Ajax(){
					var category = JSON.parse(localStorage.getItem("Conditions_category"))
					var typical = JSON.parse(localStorage.getItem("Conditions_typical"))
					var brand = JSON.parse(localStorage.getItem("Conditions_brand"))
					var model = JSON.parse(localStorage.getItem("Conditions_model"))
					var serial_number = localStorage.getItem("serial_number_arr")
					var materialTypicalId = localStorage.getItem("materialTypicalId")
					var respository = app.getUserGlobalInfo();
					var respositoryId = respository.repositoryId;
					var operator = app.getUserGlobalInfo();
					var operator_name = operator.username;
					var arr = [];
					arr.push(serial_number)
					$.ajax({
						url: app.ServerUrl + 'v1/material/inStorageMaterial/',
						type: "get",
						contentType: "application/json;charset=UTF-8",
						dataType: "json",
						async: true,
						headers: {
							"Authorization": "460bcdb0-b326-4d6d-ac99-232c83ba6d80"
						},
						data: {
							 "count": '',
							  "imei": arr,
							  "materialTypicalId": materialTypicalId,
							  "name": '',
							  "operator": operator_name,
							  "sourceRepositoryId": "",
							  "stuffId": "",
							  "targetRepositoryId": respositoryId
						},
						success: function(data) {
							console.log(data.objs[0])
							layer.open({
								content: '入库成功！',
								btnAlign: 'c',
								anim: 5,
								icon: 6,
								cancel: function() {}
							});
						},
						error: function(e) {
							console.log(e.statusText)
							layer.open({
								content: '入库失败！',
								btnAlign: 'c',
								anim: 5,
								icon: 5,
								cancel: function() {}
							});
						}
					
					})
				}
			</script>
			<script>
				var _hmt = _hmt || [];
				(function() {
					var hm = document.createElement("script");
					hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
					var s = document.getElementsByTagName("script")[0];
					s.parentNode.insertBefore(hm, s);
				})();
			</script>
	</body>

</html>
